<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Enctype</title>
    </head>
    <body>

         <!-- 对于 form 来说，不论是 get 方式 还是 post 方式提交，如果没有显式指定 enctype 属性，则默认值都是 application/x-www-form-urlencoded -->
         <form action="/enc/type" method="get" enctype="application/x-www-form-urlencoded">
             采用GET方式提交表单(application/x-www-form-urlencoded):
             <br>
             <input type="text" name="username" placeholder="请输入登录名">
             <input type="password" name="password" placeholder="请输入密码">
             <button type="submit">提交</button>
         </form>

         <hr>

         <form action="/enc/type" method="GET" enctype="text/plain">
             采用GET方式提交表单(text/plain):
             <br>
             <input type="text" name="username" placeholder="请输入登录名">
             <input type="password" name="password" placeholder="请输入密码">
             <button type="submit">提交</button>
         </form>

         <hr>

         <!-- form 元素的 enctype 用于告知浏览器如何对表单中的数据进行编码 -->
         <form action="/enc/type" method="POST" enctype="application/x-www-form-urlencoded">
             采用POST方式提交表单(application/x-www-form-urlencoded):
             <br>
             <input type="text" name="username" placeholder="请输入登录名">
             <input type="password" name="password" placeholder="请输入密码">
             <button type="submit">提交</button>
         </form>

         <hr>

         <form action="/enc/type" method="POST" enctype="text/plain">
             采用POST方式提交表单(text/plain):
             <br>
             <input type="text" name="username" placeholder="请输入登录名">
             <input type="password" name="password" placeholder="请输入密码">
             <button type="submit">提交</button>
         </form>

         <hr>

         <form action="/enc/type" method="POST" enctype="multipart/form-data">
             采用POST方式提交表单(multipart/form-data):
             <br>
             <input type="text" name="username" placeholder="请输入登录名">
             <input type="password" name="password" placeholder="请输入密码">
             <button type="submit">提交</button>
         </form>

        <hr style="border:2px solid red ; height : 0px ;">

         <!-- 务必注意这里的 action 变了 -->
         <form action="/multi/part" method="POST" enctype="multipart/form-data">
             采用POST方式提交表单(multipart/form-data):
             <br>
             <input type="text" name="username" placeholder="请输入登录名">
             <input type="password" name="password" placeholder="请输入密码">
             <button type="submit">提交</button>
         </form>

    </body>
</html>